%% simulation of the micro doppler of the rotating blade
function doppler = md_new(lightSpeed, carrFreq,...
    bladeNums, bladeLen, bladePhase)
% ---------------------------------------------------
% 用于产生指定时刻单个单元格内的螺旋桨实际多普勒频移，
% 注意，外部必须乘以螺旋桨旋转速度（Hz单位）才是真实的微多普勒频移。
% phase = mdPhase_new(lightSpeed, carrFreq,...
%     bladeNums, bladeLen, bladePhase)
% ---------输入---------
% lightSpeed 为光速，请设为3e8
% carrFreq 为雷达载波频率
% bladeNums 为叶片数量
% bladeLen 为叶片长度，单位：米
% bladePhase 为微多普勒的瞬时相位，体现为叶片的瞬时相位
% ---------输出---------
% phase 各螺旋桨的运动相位，为一列，行数为螺旋桨叶片数量
% ---------------------------------------------------
    % data verify
    dataValid = true;
    dataValid = dataValid && (length(lightSpeed) == 1);
    dataValid = dataValid && (length(carrFreq) == 1);
    dataValid = dataValid && (length(bladeNums) == 1);
    dataValid = dataValid && (length(bladeLen) == 1);
    dataValid = dataValid && (length(bladePhase) == 1);
    
    if ~dataValid
        error('请确保输入量为单值');
    end
    bladeAng  = (0 : (bladeNums - 1)) * 2 * pi / bladeNums;
    mDopAmp = (4 * pi * bladeLen * carrFreq) / lightSpeed;     % 这项调控微动震荡幅度，与叶片线速度相关
    % generate doppler
    bladeEcho = mDopAmp * cos(bladePhase + bladeAng);  % 各螺旋桨相位
    doppler = reshape(bladeEcho,[],1);
end